# Contributor: Francesco Colis_ta <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=rutorrent
_pkgname=ruTorrent
pkgver=4.3.0
pkgrel=0
pkgdesc="Yet another web front-end for rTorrent"
url="https://github.com/Novik/ruTorrent"
arch="noarch"
license="GPL-3.0-or-later"
depends="php82 curl"
options="!check" # no test available
# we need to user gnu tar since the permissions on files in tar archive are
# bad
makedepends="tar"
pkggroups="rutorrent"
install="$pkgname.pre-install $pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/Novik/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	chmod -R u+w "$builddir"
}

package() {
	install -d $pkgdir/usr/share/webapps/$pkgname
	install -d $pkgdir/var/www/localhost/htdocs/
	cp -r ./* $pkgdir/usr/share/webapps/$pkgname
	rm -fr $pkgdir/usr/share/webapps/$pkgname/tests
	chgrp -R rutorrent $pkgdir/usr/share/webapps/$pkgname/share
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/settings
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/torrents
	chmod 0775 $pkgdir/usr/share/webapps/$pkgname/share/users
}

sha512sums="
64079663162b09bafd34f5f93e3e5ea473b2acfb88af8d20e5c602cc56bbfb66d2266e86e42907c7f4319e09f32ff9884e1f79c886a2b8eb5ca148ee853133f3  rutorrent-4.3.0.tar.gz
"
